<template>
  <div>
    <p>自定义指令</p>
    <p>
      <input type="text" v-focus />
      <!--  -->
      <p v-red='"red"'>我是红色</p>
    </p>
  </div>
</template>

<script setup>
const vFocus = {
  mounted(el) {
    // el 为绑定指令的标签元素
    el.focus();
  },
};

const vRed = {
  mounted(el, binding) {
    el.style.color = binding.value;
  },
};
</script>
<style scoped>
</style>